package com.koron.common.core.business.system.feign;

import com.koron.bean.base.Response;
import com.koron.bean.system.org.OrgBean;
import com.koron.bean.system.org.dto.OrgDto;
import com.koron.bean.system.org.query.OrgQuery;
import com.koron.bean.system.post.query.PostUserQuery;
import com.koron.bean.system.post.vo.PostUserVo;
import com.koron.bean.system.staff.StaffBean;
import com.koron.bean.system.staff.vo.AppUserVo;
import com.koron.common.core.feignConfig.FeignFallbackFactory;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = "eam-service-system", fallbackFactory = FeignFallbackFactory.class)
public interface SystemFeignService {

    @ApiOperation(value = "通过组织id获取部门")
    @GetMapping("/system/org/queryDeptByOrgId")
    Response<OrgBean> queryDeptByOrgId(@RequestParam("orgId") String orgId);

    @ApiOperation(value = "不分页查询列表")
    @GetMapping("/postUser/queryList")
    Response<List<PostUserVo>> queryPostList(@SpringQueryMap PostUserQuery query);

    @ApiOperation(value = "查询单个组织信息")
    @GetMapping("/system/org/querySingleOrg")
    Response<OrgBean> querySingleOrg(@RequestParam("id") String id);

    @ApiOperation(value = "查询人员列表")
    @GetMapping("/system/staff/queryStaffListByOrg")
    Response<List<StaffBean>> queryStaffListByOrg(@SpringQueryMap StaffBean staffBean);

    /*
     * 功能描述
     * @author zhouj
     * @date 2022/1/24 10:46
     * @param [staffBean, isPage(是否分页 默认为1分页 0不分页), cascadeQuery(是否级联查询(默认1:是 0:否))]
     */
    @ApiOperation(value = "通过组织查询人员列表(支持级联查询)(多组织返回单条数据)")
    @GetMapping("/system/staff/queryStaffListByOrgWithMerge")
    Response<List<AppUserVo>> queryStaffListByOrgWithMerge(@SpringQueryMap StaffBean staffBean,
                                                                  @RequestParam(value = "isPage", required = false, defaultValue = "1") Integer isPage,
                                                                  @RequestParam(value = "cascadeQuery", required = false, defaultValue = "1") Integer cascadeQuery);


    @ApiOperation(value = "查询多个组织的部门信息")
    @GetMapping("/system/org/queryDeptByOrgIdList")
    Response<List<OrgBean>> queryDeptByOrgIdList(@SpringQueryMap OrgDto orgDto);

    @ApiOperation(value = "查询组织列表(不分页)")
    @GetMapping("/system/org/queryNextOrgList")
    Response<List<OrgBean>> queryNextOrgList(@SpringQueryMap OrgBean orgBean);

    @ApiOperation(value = "查询组织树")
    @GetMapping("/system/org/queryOrgTree")
    Response<Object> queryOrgTree(@SpringQueryMap OrgQuery orgQuery);

}
